#ifndef __GENERICEXCEPTION_H_INCLUDED__
#define __GENERICEXCEPTION_H_INCLUDED__
#include <typeinfo>
#include <iostream>
#include <execinfo.h>
#include <stdlib.h>


class GenericException:public std::exception{
private:

	std::string texto;

public:
	GenericException(const std::string &descripcion){
		texto = descripcion + "\n";

		void *array[10];
		size_t size;
		char **strings;
		size_t i;
		
		size = backtrace (array, 10);
		strings = backtrace_symbols (array, size);
		
		for (i = 0; i < size; i++){
			texto.append(strings[i]);
			texto+= "\n";
		}
		free(strings);

	}

	virtual const char* what(){
		return texto.c_str();
	}

	virtual ~GenericException() throw(){}
};

#endif // __GENERICEXCEPTION_H_INCLUDED__
